#!/usr/bin/env python
# -*- coding: utf-8 -*-

# subscribe mymessage

import rospy
from learning_topic.msg import mymessage

def InfoCallback(msg):
    rospy.loginfo("Subcribe mymessage Info: name:%s  id:%.3f", 
			 msg.name, msg.id)

def subscriber():
	# ROS节点初始化
    rospy.init_node('subscriber', anonymous=True)

	# 创建一个Subscriber，订阅名为/info的topic，注册回调函数InfoCallback
    rospy.Subscriber("/info", mymessage, InfoCallback)

	# 循环等待回调函数
    rospy.spin()

if __name__ == '__main__':
    subscriber()


